<?php
    require_once ( "../config.php" );
    
    $_id = 0;
    if ($_REQUEST!=null && isset($_REQUEST["id"]) && is_numeric($_REQUEST["id"]) ) {
        $_id = verify_id(intval($_REQUEST["id"]));
    }
    if ($_id==0) {
        $error = new my_error("param_id_error");
        exit( $error->to_string() );
    }
    
    $id = strval($_id);
    $db = new SQLite3('../_db/' . $sqlite_db_name);
    $sql = sprintf("select data from normal where uid=%s", $id);
    $res = $db->query($sql);
    if ($res==null || $res==FALSE) {
        $error = new my_error("sql_query_failed");
        exit( $error->to_string() );
    }
    if (row_num($res)==0) {
        $error = new my_error("no_data");
        exit( $error->to_string() );
    }
    $row = $res->fetchArray();
    $retval = new my_retval($row[0]);
    $retval->add("id", $id);
    exit($retval->to_string());